
var app = getApp()
// 语言
var util = require('../../utils/util.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list:[],
    p:1
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      id:options.id
    })
    this.mDetail(options.id)
  },
  // 商家明细
  mDetail(id){
    var that=this;
    wx.request({
      url: app.globalData.urls + '/wallet/detail-list',
      data: {
        id:id,
        p:this.data.p,
        type:1,
        status:1
      },
      method:'POST',
      header: app.getRequestHeader(),
      success: (res) => {
        wx.hideLoading();
        if (res.data.code == 200) {
          let data=res.data.data;
          that.setData({
            isShow:true,
            totalPage:data.totalPage,
            list:that.data.list.concat(data.list)
          })
        }
      }
    })
  },
   /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    let p=this.data.p
    console.log("----this.data.totalPage",this.data.totalPage,p)
    if(p<this.data.totalPage){
      this.setData({
        p:p+1
      })
      this.mDetail(this.data.id)
    }
  },
})